#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc,char* agrv[])
{
  pid_t pid;
  pid = fork();
  if(pid > 0)
  {
    printf("I am parent,my pid is %d,my son pid is %d\n",getpid(),pid);
  }

  else if(pid == 0)
  {
    printf("I am child,my pid is %d,my father pid is %d\n",getpid(),getppid());
  }
  else
  {
    perror("fork fail");
    exit(-1);
  }
  return 0;
}
